export default {
  props: {
    evaluation_show: {
      type: Boolean,
      default: false
    },
    urlStr:{
      type:String,
      default:"plugin.be-within-call.frontend.need-order-operate.push-remark"
    },
    order_id: {
      type: null,
      default: ''
    }
  },
  data() {
    return {
      starList:[{
        id: 1,
        isShow: false
      },{
        id: 2,
        isShow: false
      },{
        id: 3,
        isShow: false
      },{
        id: 4,
        isShow: false
      },{
        id: 5,
        isShow: false
      }],
    };
  },
  mounted() {
  },
  methods: {
    clickStar(index) {
      for(let [cindex,citem] of this.starList.entries()) {
        if(index == 0 && this.starList.filter(item => item.isShow).length == 1) {
          citem.isShow = false;
          return
        }

        if(cindex <= index ){
          citem.isShow = true;
        }else {
          citem.isShow = false;
        }
      }
      // this.starList[index].isShow = !this.starList[index].isShow;
    },
    cancal() {
      this.$emit("update:evaluation_show", false);
    },
    async sure() {
      let newArr = this.starList.filter(item => item.isShow);
      let { data, result, msg } = await $http.post(this.urlStr, { oid : this.order_id , star: newArr.length });
      console.log(newArr,'newArr');
      if(result) {
        this.$emit('commentEvent');
      }
      this.$toast(msg);
      this.$emit("update:evaluation_show", false);
    }
  },
  components: {  }
};
